package com.sword.springboot.springboot_rabbitmq.tut1;

import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Profile;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.stereotype.Component;

/**
 * com.sword.springboot.springboot_rabbitmq.tut1.Tut1CommindLineRunner
 * Created by SwordLiu on 2017-11-13.
 */
@Component
public class Tut1CommindLineRunner {

    @Profile("usage_message")
    @Bean
    public CommandLineRunner usage() {
        return strings -> {
            System.out.println("This app uses Spring Profiles to control its behavior.\n");
            System.out.println("Sample usage: java -jar rabbit-tutorials.jar --spring.profiles.active=hello-world,sender");
        };
    }

    @Profile("!usage_message")
    @Bean
    public CommandLineRunner tutorial() {
        return new RabbitAmqpTutorialsRunner();
    }

}
